﻿#pragma warning disable 1591


namespace Paradox.Models
{
	using System.Data.Linq;
	using System.Data.Linq.Mapping;
	using System.Data;
	using System.Collections.Generic;
	using System.Reflection;
	using System.Linq;
	using System.Linq.Expressions;
	using System.ComponentModel;
	using System;
	
	
	[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="RSS")]
	public partial class RSSDataContext : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertTag(Tag instance);
    partial void UpdateTag(Tag instance);
    partial void DeleteTag(Tag instance);
    partial void InsertStory(Story instance);
    partial void UpdateStory(Story instance);
    partial void DeleteStory(Story instance);
    partial void InsertComment(Comment instance);
    partial void UpdateComment(Comment instance);
    partial void DeleteComment(Comment instance);
    #endregion
		
		public RSSDataContext() : 
				base(global::System.Configuration.ConfigurationManager.ConnectionStrings["RSSConnectionString1"].ConnectionString, mappingSource)
		{
			OnCreated();
		}
		
		public RSSDataContext(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public RSSDataContext(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public RSSDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public RSSDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<Tag> Tags
		{
			get
			{
				return this.GetTable<Tag>();
			}
		}
		
		public System.Data.Linq.Table<Story> Stories
		{
			get
			{
				return this.GetTable<Story>();
			}
		}
		
		public System.Data.Linq.Table<Comment> Comments
		{
			get
			{
				return this.GetTable<Comment>();
			}
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Tags")]
	public partial class Tag : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _tagId;
		
		private string _tagName;
		
		private System.Nullable<int> _storyid;
		
		private EntityRef<Story> _Story;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OntagIdChanging(int value);
    partial void OntagIdChanged();
    partial void OntagNameChanging(string value);
    partial void OntagNameChanged();
    partial void OnstoryidChanging(System.Nullable<int> value);
    partial void OnstoryidChanged();
    #endregion
		
		public Tag()
		{
			this._Story = default(EntityRef<Story>);
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_tagId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int tagId
		{
			get
			{
				return this._tagId;
			}
			set
			{
				if ((this._tagId != value))
				{
					this.OntagIdChanging(value);
					this.SendPropertyChanging();
					this._tagId = value;
					this.SendPropertyChanged("tagId");
					this.OntagIdChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_tagName", DbType="NChar(25)")]
		public string tagName
		{
			get
			{
				return this._tagName;
			}
			set
			{
				if ((this._tagName != value))
				{
					this.OntagNameChanging(value);
					this.SendPropertyChanging();
					this._tagName = value;
					this.SendPropertyChanged("tagName");
					this.OntagNameChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_storyid", DbType="Int")]
		public System.Nullable<int> storyid
		{
			get
			{
				return this._storyid;
			}
			set
			{
				if ((this._storyid != value))
				{
					if (this._Story.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnstoryidChanging(value);
					this.SendPropertyChanging();
					this._storyid = value;
					this.SendPropertyChanged("storyid");
					this.OnstoryidChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Feed_Story_Tag", Storage="_Story", ThisKey="storyid", OtherKey="id", IsForeignKey=true, DeleteRule="CASCADE")]
		public Story Story
		{
			get
			{
				return this._Story.Entity;
			}
			set
			{
				Story previousValue = this._Story.Entity;
				if (((previousValue != value) 
							|| (this._Story.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Story.Entity = null;
						previousValue.Tags.Remove(this);
					}
					this._Story.Entity = value;
					if ((value != null))
					{
						value.Tags.Add(this);
						this._storyid = value.id;
					}
					else
					{
						this._storyid = default(Nullable<int>);
					}
					this.SendPropertyChanged("Story");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Feed_Stories")]
	public partial class Story : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private System.DateTime _posted_on;
		
		private int _id;
		
		private string _title;
		
		private string _Author;
		
		private string _StoryText;
		
		private string _last_edited_by;
		
		private System.Nullable<System.DateTime> _last_edited_on;
		
		private bool _publishToRSS;
		
		private EntitySet<Tag> _Tags;
		
		private EntitySet<Comment> _Comments;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void Onposted_onChanging(System.DateTime value);
    partial void Onposted_onChanged();
    partial void OnidChanging(int value);
    partial void OnidChanged();
    partial void OntitleChanging(string value);
    partial void OntitleChanged();
    partial void OnAuthorChanging(string value);
    partial void OnAuthorChanged();
    partial void OnStoryTextChanging(string value);
    partial void OnStoryTextChanged();
    partial void Onlast_edited_byChanging(string value);
    partial void Onlast_edited_byChanged();
    partial void Onlast_edited_onChanging(System.Nullable<System.DateTime> value);
    partial void Onlast_edited_onChanged();
    partial void OnpublishToRSSChanging(bool value);
    partial void OnpublishToRSSChanged();
    #endregion
		
		public Story()
		{
			this._Tags = new EntitySet<Tag>(new Action<Tag>(this.attach_Tags), new Action<Tag>(this.detach_Tags));
			this._Comments = new EntitySet<Comment>(new Action<Comment>(this.attach_Comments), new Action<Comment>(this.detach_Comments));
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_posted_on", DbType="DateTime NOT NULL")]
		public System.DateTime posted_on
		{
			get
			{
				return this._posted_on;
			}
			set
			{
				if ((this._posted_on != value))
				{
					this.Onposted_onChanging(value);
					this.SendPropertyChanging();
					this._posted_on = value;
					this.SendPropertyChanged("posted_on");
					this.Onposted_onChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int id
		{
			get
			{
				return this._id;
			}
			set
			{
				if ((this._id != value))
				{
					this.OnidChanging(value);
					this.SendPropertyChanging();
					this._id = value;
					this.SendPropertyChanged("id");
					this.OnidChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(150)")]
		public string title
		{
			get
			{
				return this._title;
			}
			set
			{
				if ((this._title != value))
				{
					this.OntitleChanging(value);
					this.SendPropertyChanging();
					this._title = value;
					this.SendPropertyChanged("title");
					this.OntitleChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Author", DbType="NVarChar(50)")]
		public string Author
		{
			get
			{
				return this._Author;
			}
			set
			{
				if ((this._Author != value))
				{
					this.OnAuthorChanging(value);
					this.SendPropertyChanging();
					this._Author = value;
					this.SendPropertyChanged("Author");
					this.OnAuthorChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StoryText", DbType="Text", UpdateCheck=UpdateCheck.Never)]
		public string StoryText
		{
			get
			{
				return this._StoryText;
			}
			set
			{
				if ((this._StoryText != value))
				{
					this.OnStoryTextChanging(value);
					this.SendPropertyChanging();
					this._StoryText = value;
					this.SendPropertyChanged("StoryText");
					this.OnStoryTextChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_last_edited_by", DbType="NVarChar(50)")]
		public string last_edited_by
		{
			get
			{
				return this._last_edited_by;
			}
			set
			{
				if ((this._last_edited_by != value))
				{
					this.Onlast_edited_byChanging(value);
					this.SendPropertyChanging();
					this._last_edited_by = value;
					this.SendPropertyChanged("last_edited_by");
					this.Onlast_edited_byChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_last_edited_on", DbType="DateTime")]
		public System.Nullable<System.DateTime> last_edited_on
		{
			get
			{
				return this._last_edited_on;
			}
			set
			{
				if ((this._last_edited_on != value))
				{
					this.Onlast_edited_onChanging(value);
					this.SendPropertyChanging();
					this._last_edited_on = value;
					this.SendPropertyChanged("last_edited_on");
					this.Onlast_edited_onChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_publishToRSS", DbType="Bit NOT NULL")]
		public bool publishToRSS
		{
			get
			{
				return this._publishToRSS;
			}
			set
			{
				if ((this._publishToRSS != value))
				{
					this.OnpublishToRSSChanging(value);
					this.SendPropertyChanging();
					this._publishToRSS = value;
					this.SendPropertyChanged("publishToRSS");
					this.OnpublishToRSSChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Feed_Story_Tag", Storage="_Tags", ThisKey="id", OtherKey="storyid")]
		public EntitySet<Tag> Tags
		{
			get
			{
				return this._Tags;
			}
			set
			{
				this._Tags.Assign(value);
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Feed_Story_Comment", Storage="_Comments", ThisKey="id", OtherKey="story_id")]
		public EntitySet<Comment> Comments
		{
			get
			{
				return this._Comments;
			}
			set
			{
				this._Comments.Assign(value);
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Tags(Tag entity)
		{
			this.SendPropertyChanging();
			entity.Story = this;
		}
		
		private void detach_Tags(Tag entity)
		{
			this.SendPropertyChanging();
			entity.Story = null;
		}
		
		private void attach_Comments(Comment entity)
		{
			this.SendPropertyChanging();
			entity.Story = this;
		}
		
		private void detach_Comments(Comment entity)
		{
			this.SendPropertyChanging();
			entity.Story = null;
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Comments")]
	public partial class Comment : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _id;
		
		private string _comment_posted_by;
		
		private string _comment_title;
		
		private string _poster_website;
		
		private string _comment_body;
		
		private int _story_id;
		
		private string _poster_ip;
		
		private string _poster_domain;
		
		private System.DateTime _comment_posted_on;
		
		private EntityRef<Story> _Story;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnidChanging(int value);
    partial void OnidChanged();
    partial void Oncomment_posted_byChanging(string value);
    partial void Oncomment_posted_byChanged();
    partial void Oncomment_titleChanging(string value);
    partial void Oncomment_titleChanged();
    partial void Onposter_websiteChanging(string value);
    partial void Onposter_websiteChanged();
    partial void Oncomment_bodyChanging(string value);
    partial void Oncomment_bodyChanged();
    partial void Onstory_idChanging(int value);
    partial void Onstory_idChanged();
    partial void Onposter_ipChanging(string value);
    partial void Onposter_ipChanged();
    partial void Onposter_domainChanging(string value);
    partial void Onposter_domainChanged();
    partial void Oncomment_posted_onChanging(System.DateTime value);
    partial void Oncomment_posted_onChanged();
    #endregion
		
		public Comment()
		{
			this._Story = default(EntityRef<Story>);
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int id
		{
			get
			{
				return this._id;
			}
			set
			{
				if ((this._id != value))
				{
					this.OnidChanging(value);
					this.SendPropertyChanging();
					this._id = value;
					this.SendPropertyChanged("id");
					this.OnidChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_comment_posted_by", DbType="VarChar(50) NOT NULL", CanBeNull=false)]
		public string comment_posted_by
		{
			get
			{
				return this._comment_posted_by;
			}
			set
			{
				if ((this._comment_posted_by != value))
				{
					this.Oncomment_posted_byChanging(value);
					this.SendPropertyChanging();
					this._comment_posted_by = value;
					this.SendPropertyChanged("comment_posted_by");
					this.Oncomment_posted_byChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_comment_title", DbType="VarChar(50)")]
		public string comment_title
		{
			get
			{
				return this._comment_title;
			}
			set
			{
				if ((this._comment_title != value))
				{
					this.Oncomment_titleChanging(value);
					this.SendPropertyChanging();
					this._comment_title = value;
					this.SendPropertyChanged("comment_title");
					this.Oncomment_titleChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_poster_website", DbType="VarChar(300)")]
		public string poster_website
		{
			get
			{
				return this._poster_website;
			}
			set
			{
				if ((this._poster_website != value))
				{
					this.Onposter_websiteChanging(value);
					this.SendPropertyChanging();
					this._poster_website = value;
					this.SendPropertyChanged("poster_website");
					this.Onposter_websiteChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_comment_body", DbType="Text NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public string comment_body
		{
			get
			{
				return this._comment_body;
			}
			set
			{
				if ((this._comment_body != value))
				{
					this.Oncomment_bodyChanging(value);
					this.SendPropertyChanging();
					this._comment_body = value;
					this.SendPropertyChanged("comment_body");
					this.Oncomment_bodyChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_story_id", DbType="Int NOT NULL")]
		public int story_id
		{
			get
			{
				return this._story_id;
			}
			set
			{
				if ((this._story_id != value))
				{
					if (this._Story.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.Onstory_idChanging(value);
					this.SendPropertyChanging();
					this._story_id = value;
					this.SendPropertyChanged("story_id");
					this.Onstory_idChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_poster_ip", DbType="VarChar(16)")]
		public string poster_ip
		{
			get
			{
				return this._poster_ip;
			}
			set
			{
				if ((this._poster_ip != value))
				{
					this.Onposter_ipChanging(value);
					this.SendPropertyChanging();
					this._poster_ip = value;
					this.SendPropertyChanged("poster_ip");
					this.Onposter_ipChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_poster_domain", DbType="VarChar(300)")]
		public string poster_domain
		{
			get
			{
				return this._poster_domain;
			}
			set
			{
				if ((this._poster_domain != value))
				{
					this.Onposter_domainChanging(value);
					this.SendPropertyChanging();
					this._poster_domain = value;
					this.SendPropertyChanged("poster_domain");
					this.Onposter_domainChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_comment_posted_on", DbType="DateTime NOT NULL")]
		public System.DateTime comment_posted_on
		{
			get
			{
				return this._comment_posted_on;
			}
			set
			{
				if ((this._comment_posted_on != value))
				{
					this.Oncomment_posted_onChanging(value);
					this.SendPropertyChanging();
					this._comment_posted_on = value;
					this.SendPropertyChanged("comment_posted_on");
					this.Oncomment_posted_onChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Feed_Story_Comment", Storage="_Story", ThisKey="story_id", OtherKey="id", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
		public Story Story
		{
			get
			{
				return this._Story.Entity;
			}
			set
			{
				Story previousValue = this._Story.Entity;
				if (((previousValue != value) 
							|| (this._Story.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Story.Entity = null;
						previousValue.Comments.Remove(this);
					}
					this._Story.Entity = value;
					if ((value != null))
					{
						value.Comments.Add(this);
						this._story_id = value.id;
					}
					else
					{
						this._story_id = default(int);
					}
					this.SendPropertyChanged("Story");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}
#pragma warning restore 1591
